package com.wuyou.simple;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class AreAlmostEqual {


    public static void main(String[] args) {
        System.out.println((int)'a');
    }




    public boolean solution_2(String s1, String s2){
        if(s1.equals(s2)) return true;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < s1.length(); i++) {
            if (!s2.contains(s1.charAt(i) + "")) return false;
            if(s1.charAt(i) != s2.charAt(i)){
                list.add(i);
            }
        }
        if(list.size() == 0) return true;
        if(list.size() == 2 && (s1.charAt(list.get(0)) == s2.charAt(list.get(1)) && s1.charAt(list.get(1)) == s2.charAt(list.get(0)))) {
            return true;
        }
        return false;
    }

    public boolean solution_1(String s1, String s2){

        if(s1.equals(s2)) return true;
        int flag = 0;
        int[] c = new int[26];
        for (int i = 0; i < s1.length(); i++) {
            if(!s2.contains(s1.charAt(i) + "")) return false;
            c[s1.charAt(i) - 92] += 1;
            c[s2.charAt(i) - 92] -= 1;
            if(s1.charAt(i) != s2.charAt(i)) flag ++;
        }
        for (int i = 0; i < c.length; i++) {
            if(c[i] != 0)return false;
        }
        return flag == 2;
    }
}
